import {createRouter, createWebHistory} from 'vue-router'
import HomeView from "@/views/HomeView.vue";
import ManagerViewContainer from "@/views/manager/ManagerViewContainer.vue";
import PostListView from "../views/manager/post/PostListView.vue";
import PostEditorView from "../views/manager/post/PostEditorView.vue";
import HomeCategoryPostsView from "@/views/HomeCategoryPostsView.vue";
import HomeMainPostsView from "@/views/HomeMainPostsView.vue";
import PostView from "@/views/post/PostView.vue";
import CarouselListView from "@/views/manager/CarouselListView.vue";
import CategoryManagerView from "../views/manager/post/CategoryManagerView.vue";
import RoleListView from "@/views/manager/permission/RoleListView.vue";
import PermissionListView from "@/views/manager/permission/PermissionListView.vue";
import DraftListView from "@/views/manager/post/DraftListView.vue";
import LevelPermissionView from "@/views/manager/permission/LevelPermissionView.vue";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'main',
      component: HomeView,
      children: [
        {
          path: '',
          name: 'main-all',
          component: HomeMainPostsView
        },
        {
          path: 'cat/:catId',
          name: 'main-cat-posts',
          component: HomeCategoryPostsView
        },
        {
          path: 'post/:postId',
          name: 'main-post-view',
          component: PostView
        }
      ]
    },
    {
      path: '/manager',
      name: 'manager',
      component: ManagerViewContainer,
      children: [
        {
          path: 'posts',
          name: 'manager-posts',
          children: [
            {
              path: '',
              name: 'manager-posts-view',
              component: PostListView
            },
            {
              path: 'editor',
              name: 'manager-posts-editor',
              component: PostEditorView
            },
            {
              path: 'drafts',
              name: 'manager-posts-drafts',
              component: DraftListView
            }
          ]
        },
        {
          path: 'carousels',
          name: 'manager-carousels',
          component: CarouselListView
        },
        {
          path: 'categories',
          name: 'manager-categories',
          component: CategoryManagerView
        },
        {
          path: 'roles',
          name: 'manager-role',
          component: RoleListView
        },
        {
          path: 'permissions',
          name: 'manager-permissions',
          component: PermissionListView
        },
        {
          path: 'level-permissions',
          name: 'manager-level-permissions',
          component: LevelPermissionView
        }
      ]
    }
  ],
})

export default router
